﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IHISCETeim.DAL;
using IHISCETeim.Model;
using IHISCETeim.Library;
using System.Data;

namespace IHISCETeim.BLL
{
    public class UClaimDemageController : BaseController
    {
        public static int Add(UClaimDemageInfo obj)
        {
            return UClaimDemageDAL.Add(obj);
        }
        public static bool Delete(int ID)
        {
            return UClaimDemageDAL.Delete(ID);
        }
        public static UClaimDemageInfo GetById(int ID)
        {
            return CBO.FillObject<UClaimDemageInfo>( UClaimDemageDAL.GetById(ID));
        }
        public static DataTableCollection GetPagination(string WhereSql, int PageIndex, int PageSize, string Sort, ref int TotalCount)
        {
            return UClaimDemageDAL.GetPagination(WhereSql, PageIndex, PageSize, Sort, ref  TotalCount);
        }
        public static bool UpdateInStock(int ID, bool InStock, DateTime InDate, decimal InQuantity, string InOrderNum, string InRemark, decimal InWuPan, bool IsPan, int InGuiFan, string GoTrack, string GOTrackDate)
        {
            return UClaimDemageDAL.UpdateInStock(ID, InStock, InDate, InQuantity, InOrderNum, InRemark, InWuPan, IsPan, InGuiFan,GoTrack,GOTrackDate);
        }
        /// <summary>
        /// 获取旧件未完全返回的记录提醒
        /// </summary>
        /// <returns></returns>
        public static DataTable GetInWillAlermList()
        {
            return UClaimDemageDAL.GetInWillAlermList();
        }
        /// <summary>
        /// 获取旧件索赔统计报表
        /// </summary>
        /// <param name="fromdate"></param>
        /// <param name="todate"></param>
        /// <returns></returns>
        public static DataTableCollection GetTongJiReport(string fromdate, string todate)
        {
            return UClaimDemageDAL.GetTongJiReport(fromdate, todate);
        }
        /// <summary>
        /// 获取代理商旧件索赔统计报表
        /// </summary>
        /// <param name="fromdate"></param>
        /// <param name="todate"></param>
        /// <returns></returns>
        public static DataTableCollection GetAgentTongJiReportDetail(string agentname, string fromdate, string todate)
        {
            return UClaimDemageDAL.GetAgentTongJiReportDetail(agentname, fromdate, todate);
        }

        /// <summary>
        /// 根据品情号获取所有索赔件
        /// </summary>
        /// <param name="ClaimsNumber"></param>
        /// <returns></returns>
        public static DataTable GetByClaimsNumber(string ClaimsNumber)
        {
            return UClaimDemageDAL.GetByClaimsNumber(ClaimsNumber);
        }

        /// <summary>
        /// 根据物料代码，统计各物料的索赔情况，质管部要求
        /// </summary>
        /// <param name="fromdate"></param>
        /// <param name="todate"></param>
        /// <returns></returns>
        public static DataTableCollection GetItemCodeTongJiReport(string fromdate, string todate)
        {
            return UClaimDemageDAL.GetItemCodeTongJiReport(fromdate, todate);
        }

        /// <summary>
        /// 获取代理商的点检完成率报表
        /// </summary>
        /// <param name="fromdate"></param>
        /// <param name="todate"></param>
        /// <returns></returns>
        public static DataTableCollection GetCheckReport(string fromdate, string todate)
        {
            return UClaimDemageDAL.GetCheckReport(fromdate, todate);
        }
        /// <summary>
        /// 新机入库点检报表
        /// </summary>
        /// <param name="fromdate"></param>
        /// <param name="todate"></param>
        /// <returns></returns>
        public static DataTableCollection NewCheckReport(string fromdate, string todate)
        {
            return UClaimDemageDAL.NewCheckReport(fromdate, todate);
        }
         /// <summary>
        /// 清理旧件
        /// </summary>
        /// <param name="AgentName"></param>
        /// <param name="SerialNumber"></param>
        /// <param name="ClaimsNumber"></param>
        /// <param name="ItemCode"></param>
        public static void ClearInWillAlerm(string AgentName, string SerialNumber, string ClaimsNumber, string ItemCode, string remark, string InQuantity)
        {
            UClaimDemageDAL.ClearInWillAlerm(AgentName, SerialNumber, ClaimsNumber, ItemCode, remark, InQuantity);
        } 

        /// <summary>
        /// 更新索赔件发货短信已发送
        /// </summary>
        /// <param name="ID"></param>
        public static void UpdateSendSMS(int ID,bool sendmsg,string remark)
        {
            UClaimDemageDAL.UpdateSendSMS(ID, sendmsg, remark);
        }
        /// <summary>
        /// 获取索赔件发货需通知列表
        /// 表1,为所有经销商列表
        /// 表2,为所有明细
        /// </summary>
        /// <returns></returns>
        public static DataTableCollection GetSPSendList()
        {
            return UClaimDemageDAL.GetSPSendList();
        }
        /// <summary>
        /// 旧件返回误判率（累计件数/返回件数）
        /// </summary>
        /// <param name="f"></param>
        /// <param name="t"></param>
        /// <returns></returns>
        public static DataTable GetWuPaiBiLi(string f, string t)
        {
            return UClaimDemageDAL.GetWuPaiBiLi(f,t);
        }
        /// <summary>
        /// 旧件返回规范
        /// </summary>
        /// <param name="f"></param>
        /// <param name="t"></param>
        /// <returns></returns>
        public static DataTable GetInGuiFan(string f, string t)
        {
            return UClaimDemageDAL.GetInGuiFan(f, t);
        }
      
    }
}
